import 'package:shared_preferences/shared_preferences.dart';

//工具类
class Utils {

  // 设置缓存
  static void setCacheData(key, value) async {
    SharedPreferences _prefs = await SharedPreferences.getInstance();
    _prefs.setString(key, value);
  }

  // 获取缓存
  static  Future<String> getCacheData(key) async {
    SharedPreferences _prefs = await SharedPreferences.getInstance();
    return _prefs.getString(key);
  }

  // 删除缓存
  static void removeCacheData(key) async {
    SharedPreferences _prefs = await SharedPreferences.getInstance();
    _prefs.remove(key);
  }

  // 清空缓存
  static void clearCacheData() async {
    SharedPreferences _prefs = await SharedPreferences.getInstance();
    _prefs.clear();
  }


}
